void main() {
  Alipay aliPay = Alipay();
  aliPay.pay(10.0);

  Wechatpay wechatPay = Wechatpay();
  wechatPay.pay(20.0);

  Unionpay unionPay = Unionpay();
  unionPay.pay(30.0);
}

/**
 * 抽象类
 * 只负责定义，不负责实现
 */
abstract class Payment {
  void pay(double money);
}

/**
 * 具体类
 * 继承抽象类
 */

class Alipay implements Payment {
  // implements : 继承并实现
  @override // 重写父组件的pay方法
  void pay(double money) {
    print('支付宝支付了${money}元');
  }
}

class Wechatpay implements Payment {
  @override
  void pay(double money) {
    print('微信支付了${money}元');
  }
}

class Unionpay implements Payment {
  @override
  void pay(double money) {
    print('银联支付了${money}元');
  }
}
